{extend name="base/index"/}

{block name="page_location"}
<div class="row">
	<div class="col-12">
		<div class="page-title-box">
			<div class="page-title-right">
				<ol class="breadcrumb m-0">
					<li class="breadcrumb-item"><a href="{:url('index/index')}">管理中心</a></li>
					<li class="breadcrumb-item active"><i class="iconfont icon-angle-right"></i>广告管理</li>
				</ol>
			</div>
			<h4 class="page-title">
				所有广告分类
				<a href="{:url('ad/publish')}" class="btn btn-success btn-sm ml-3"  data-toggle="modal" data-target="#new_box" id="add_ad_dig">创建广告分类</a>
			</h4>
		</div>
	</div>
</div>
{/block}

{block name="body"}
<div class="row" id="ad_class_page">
	<div class="col-12">
		<div class="card">
			<div class="card-body">
				<form action="" method="get"  id="search_frm">
					<div class="form-row align-items-center">
						<div class="col-auto">
							<label class="sr-only" for="inlineFormInputGroup"></label>
							<div class="input-group mb-2">
								<div class="input-group-prepend">
									<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true"
									 aria-expanded="false">操作</button>
									<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);">
										<a href="javascript:;" class="dropdown-item check_select_btn" attr-type="all" attr-bind="check_id">全选</a>
										<a href="javascript:;" class="dropdown-item check_select_btn" attr-type="reverse" attr-bind="check_id">反选</a>
										<a href="javascript:;" class="dropdown-item check_select_btn" attr-type="cancel" attr-bind="check_id">取消</a>
									</div>
								</div>
								<div class="input-group-addon">
									<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true"
									 aria-expanded="false">操作选中</button>
									<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);">
										<a href="javascript:;" class="dropdown-item Fast_Bat" attr-type="del" attr-model="adclass" attr-class=".check_id">删除</a>
									</div>
								</div>								
							</div>
						</div>
						<div class="col-auto">
							<label class="sr-only" for="inlineFormInputGroup"></label>
							<div class="input-group mb-2">
								<input type="text" class="form-control kw enter_goto" attr-event="search_btn" name="kw" placeholder="输入关键字" value="">
								<button type="button" class="input-group-append btn btn-primary search_btn" attr-ipt="kw" attr-url="{:url('adclass/index')}">搜索</button>
							</div>
						</div>
					</div>
				</form>
				<table class="table table-hover">
                    <thead>
                        <tr>
                            <th>选择</th>
                            <th>ID</th>
                            <th>分类名</th>
                            <th>描述</th>
                            <th>分类图片</th>
                            <th>更新时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {volist name='list' id="data"}
                            <tr>
	                            <td>
									<div class="custom-control custom-checkbox">
										<input type="checkbox" class="custom-control-input check_id" id="check_id{$data.id}" value="{$data.id}" name="check_id[]">
										<label class="custom-control-label" for="check_id{$data.id}">ID:{$data.id}</label>
									</div>
	                            </td>                            	
                                <td>{$data.id}</td>
                                <td>{$data.classname}</td>
                                <td>{$data.description}</td>
                                <td><a href="javascript:;"><img class="preview_img" src="{$data.picurl}" /></a></td>
                                <td><span class="badge badge-primary">{$data.posttime|date="m-d H:i",###}</span></td>
                                <td>
                                    <a href="javascript:;" class="btn btn-primary btn-sm edit_btn" attr-id="{$data.id}" data-toggle="modal" data-target="#new_box"><i class="iconfont icon-icon_compile"></i> 修改</a>
                                    <a href="javascript:;" class="btn btn-danger btn-sm Fast_Del" attr-id="{$data.id}" attr-model="adclass"><i class="iconfont icon-icon_delete_fill"></i> 删除</a>
                                </td>
                            </tr>
                        {/volist}
                    </tbody>
                </table>
			</div>
		</div>
	</div>
</div>
<!-- END PAGE CONTENT-->
{/block}
{block name="modal_dig"}
    <!-- Modal -->
    <div class="modal fade" id="new_box" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-dialog modal-full-700">
        <div class="modal-content">
          <div class="modal-header">
            <h4 class="modal-title dig_title" id="myModalLabel">创建广告分类</h4>
			<button type="button" class="close" data-dismiss="modal">x</button>
          </div>
          <div class="modal-body">
                <form action="#" class="form-horizontal" id="edit_ad_class_frm">    
                	<input type="hidden" name="id" value="" />
                    <div class="form-group row mb-1">
                        <label class="col-2 col-form-label">分类名：</label>
                        <div class="col-5">
                            <input type="text" name="classname" placeholder="请输入分类名" class="form-control ipt_check" data-type="string" data-len="1-100" nullmsg="分类名不能为空" errormsg="分类名由1-100个字符组成！"  value="">
                        </div>
						<div class="col-2">
							<span class="font-13 text-muted">必填</span>
						</div>
                    </div>
	                <div class="form-group row mb-1">
	                    <label class="col-2 col-form-label">分类图片：</label>
	                    <div class="col-5 picurl_pc_box">
		                    <div class="picurl" data-type="upload" attr-inputname="picurl" nullmsg="PC图片没有上传" attr-value=""  isCompress="1"></div>
	                    </div>
	                </div>
                    <div class="form-group row mb-1">
                        <label class="col-2 col-form-label">分类描述：</label>
                        <div class="col-5">
                            <textarea class="form-control" name="description" rows="3"></textarea>
                        </div>
                    </div>                   
                </form>
          </div>
          <div class="modal-footer">    
            <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
            <button type="button" class="btn btn-primary Fast_Form_Post" attr-frm="#edit_ad_class_frm" attr-callback="reload" attr-model="adclass" attr-active="save_adclass">保存</button>
          </div>
        </div>
      </div>
    </div>
{/block}